<div class="tpl-content-page-title">支付订单</div>
<ol class="am-breadcrumb">
	<li><a href="#" class="am-icon-home">首页</a></li>
	<li><a href="#">云造型会员</a></li>
	<li class="am-active">支付订单</li>
</ol>
<div class="tpl-portlet-components">
	<div class="portlet-title">
		<div class="caption font-green bold">
			<!-- <span class="am-icon-code"></span> 表单 -->
		</div>
		<div class="tpl-portlet-input tpl-fz-ml">
			<div class="portlet-input input-small input-inline">
				<div class="input-icon right">
				<!-- 	<i class="am-icon-search"></i> <input type="text"
						class="form-control form-control-solid" placeholder="搜索..."> -->
				</div>
			</div>
		</div>

	</div>
	<div class="tpl-block ">

		<div class="am-g tpl-amazeui-form">

			<div class="am-u-sm-12 am-u-md-9">
				<form class="am-form am-form-horizontal">
					<div class="am-form-group">
						<label for="user-name" class="am-u-sm-3 am-form-label">商品名称
							</label>
						<div class="am-u-sm-9">
							<input type="text" id="item-name" readonly="true">
						</div>
					</div>

					<div class="am-form-group">
						<label for="user-phone" class="am-u-sm-3 am-form-label">商品价格</label>
						<div class="am-u-sm-9">
							<input type="tel" id="item-price" readonly="true">
						</div>
					</div>

					<div class="am-form-group">
						<label for="user-QQ" class="am-u-sm-3 am-form-label">设计师</label>
						<div class="am-u-sm-9">
							<input type="text" id="designerId" readonly="true">
						</div>
					</div>
					
					<div class="am-form-group">
						<label for="user-email" class="am-u-sm-3 am-form-label">会员名称
							</label>
						<div class="am-u-sm-9">
							<input type="text" id="member-name" readonly="true"> 
						</div>
					</div>

					<div class="am-form-group">
						<label for="user-email" class="am-u-sm-3 am-form-label">手机号码
							</label>
						<div class="am-u-sm-9">
							<input type="text" id="member-mobile" readonly="true"> 
						</div>
					</div>
					
					<div class="am-form-group">
						<label for="user-weibo" class="am-u-sm-3 am-form-label">付款方式</label>
						<div class="am-u-sm-9">
							<input type="text" id="pay-type" readonly="true">
						</div>
					</div>
					
					<div class="am-form-group">
						<label for="user-weibo" class="am-u-sm-3 am-form-label">账户余额</label>
						<div class="am-u-sm-9">
							<input type="text" id="accountId" readonly="true">
						</div>
					</div>
					
					<!-- <div class="am-form-group">
						<label for="user-weibo" class="am-u-sm-3 am-form-label">付款时间</label>
						<div class="am-u-sm-9">
							<input type="text" id="pay-time" readonly="true">
						</div>
					</div> -->
					
					<div class="am-form-group">
						<div class="am-u-sm-9 am-u-sm-push-3">
							<button type="button" class="am-btn am-btn-cancel">返回订单</button>
							<button type="button" class="am-btn am-btn-pay">确认支付</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
	$(function(){
		doInitOrderInfo()
		$(".am-btn-cancel").click(doCancel)
		$(".am-btn-pay").click(doPayInfo)
		
	})
	
	// 支付订单信息
	function doPayInfo(){
		if(!confirm("是否提交订单！"))return;
		var data=$(".tpl-content-wrapper").data("data");
		// 请求参数
		var url = "order/doPayOrderById"
		var itemPrice = data.itemPrice;
		var id = data.id;
		var memberMobile = data.memberMobile;	
		console.log(id+itemPrice+data.memberMobile);
		// 发送请求
		var params = {"itemPrice":itemPrice,
					         "id":id,
					 "memberMobile":memberMobile}
		
		$.post(url,params,function(result){
			if(result.state==1){
				alert(result.message);
				doCancel();
			}else{
				console.log("余额不足");
				alert("账户余额不足，请充值！")
			}
		});
	}
	
	// 返回订单页面
	function doCancel(){
		$(".tpl-content-wrapper").load("order-info.html");
	}
	
	// 初始化订单信息
	function doInitOrderInfo(){
		var data=$(".tpl-content-wrapper").data("data");
		
		$("#item-name").val(data.itemName);
		$("#item-price").val(data.itemPrice);
		
		$("#designerId").val(data.designer);
		
		$("#member-name").val(data.memberName);
		$("#member-mobile").val(data.memberMobile);
		$("#pay-type").val(data.payType);
		$("#accountId").val(data.account);  // 余额
		/* $("#pay-time").val(new Date(data.payTime).toLocaleString()); */ 
	}
</script>








